<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let result = {
        code: 200,
        state: "ok",
        goodCate: "电子产品",
        goodsList: [
          {
            id: 100012,
            goodsPrice: 6999,
            goodsName: "MateBook",
            goodsCount: 99,
            goodsRank: 1,
            goodsBrand: "HUAWEI",
          },
          {
            id: 100032,
            goodsPrice: 4999,
            goodsName: "Air13",
            goodsCount: 86,
            goodsRank: 3,
            goodsBrand: "XIAOMI",
          },
          {
            id: 100095,
            goodsPrice: 16000,
            goodsName: "MacBookPro",
            goodsCount: 14,
            goodsRank: 2,
            goodsBrand: "Apple",
          },
        ],
      }
      // 第一问
      if (result.code === 200) {
        document.write(`${result.goodCate}<br>`)
      }

      // 第二问
      for (let key in result.goodsList) {
        console.log(result.goodsList)
      }
    </script>
  </body>
</html>
